package com.yihuan.service;

import com.yihuan.entity.CollectionCompEntity;
import com.yihuan.mapper.CollectionCompMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Author:梦醒
 * Date: 2022/5/5 15:24
 * Dream:
 * 信言不美，美言不信。
 * 善者不辩，辩者不善。
 * 知者不博，博者不知。
 * Function:
 */
@Service
public class CollectionCompService {
    @Resource
    CollectionCompMapper collectionCompMapper;
    
    /**
     * 新增公司收藏信息
     *
     * @param collectionCompEntity
     * @return
     */
    public int insertCollectionCompByCollectionCompData(CollectionCompEntity collectionCompEntity) {
        return collectionCompMapper.insertCollectionCompByCollectionCompData(collectionCompEntity);
    }
    
    /**
     * 查询公司收藏信息是否已存在过
     *
     * @param collectionCompEntity
     * @return
     */
    public List<CollectionCompEntity> findCollectionCompByCollectionCompByID(CollectionCompEntity collectionCompEntity) {
        return collectionCompMapper.findCollectionCompByCollectionCompByID(collectionCompEntity);
    }
    
    /**
     * 查询用户收藏
     *
     * @param collectionCompEntity
     * @return
     */
    public List<CollectionCompEntity> findCollectionCompByCollectionComp(CollectionCompEntity collectionCompEntity) {
        return collectionCompMapper.findCollectionCompByCollectionComp(collectionCompEntity);
    }
    
    /**
     * 取消收藏
     *
     * @param collectionCompEntity
     * @return
     */
    public int updateCollectionCompByCollectionComp(CollectionCompEntity collectionCompEntity) {
        return collectionCompMapper.updateCollectionCompByCollectionComp(collectionCompEntity);
    }
}
